import PageAnchor from 'components/PageAnchor'
import React, { Component, createRef } from 'react'
import styles from './index.module.scss'
import RunWatchNew from '../../components/Home/RunWatchNew'
import RunTips from 'components/Home/RunTips'

export default class Home extends Component {
  state = {
    isLoading: false,
    anchorInfoArr: [],
    anchorInfo: [
      {
        link: '#leader_runTips',
        title: '运行提示',
        isShow: true,
        partCode: 'all_runtip'
      },
      {
        link: '#leader_runWatch',
        title: '运行总览',
        isShow: true,
        partCode: 'all_runOverview'
      }
    ]
  }
  AnchorBox = createRef()
  render() {
    return (
      <div ref={this.AnchorBox}>
        {/* -----------------------------------------------------------------------运行提示--------------------------------------------------------------------- */}
        <div id="leader_runTips">
          {this.state.anchorInfo[0].isShow ? <RunTips /> : null}
        </div>
        {/* -----------------------------------------------------------------------运行总览--------------------------------------------------------------------- */}
        <div id="leader_runWatch">
          {this.state.anchorInfo[1].isShow ? <RunWatchNew /> : null}
        </div>
        {this.state.isLoading ? null : (
          <PageAnchor
            anchorBox={this.AnchorBox}
            anchorInfoArr={this.state.anchorInfo}
          />
        )}
      </div>
    )
  }
}
